import Mock from '../../mockjs/dist/mock-min.js';

let order = [{
		key: "/order/page",
		method: "get",
		param: {
			current: 1,
			size: 10,
			clientId: 1,
			orderId: 1,
			tel: "",
			statu: "",
			ct: "",
		},
		data: () => {
			return Mock.mock({
				'STATUS': "SUCCESS",
				'DATA': {
					'current': 0,
					'size': 10,
					'pages': 2,
					'total': 55,
					"records|10": [{
						'id': '@increment(1)',
						'salerId': '@increment(1)',
						'clientId': '@increment(1)',
						'clientName': '@cname()',
						'amount|4-6': /[1-9]/,
						'payId': '@increment(1)',
						'statu': 'USD',
						'address': '@county(true)',
						'reciver': '@cname()',
						'tel|11': /[0-9]/,
						'ct': '@datetime("yyyy-MM-dd hh:mm:ss")',
						'orderItems|1-2': [{
							'id': '@increment(1)',
							'productId': '@increment(1)',
							'productName': '@cparagraph()',
							'count|1-2': /[1-9]/,
							'price|1-5': /[1-9]/,
							'total|2-6': /[1-9]/,
							'productCover': '@image("120x120")',
							'count': 1,
						}]
					}]
				}
			});
		}
	},
	{
		key: "/order/info",
		method: "get",
		param: {
			id: 0,
		},
		data: Mock.mock({
			'STATUS': "SUCCESS",
			'DATA': {
				'order': {
					'id': '@increment(1)',
					'salerId': '@increment(1)',
					'clientId': '@increment(1)',
					'clientName': '@cname()',
					'amount': '@increment(2)',
					'payId': '@increment(1)',
					'statu': 'CAL',
					'address': '@cparagraph()',
					'reciver': '@cname()',
					'tel|11': /[0-9]/,
					'ct': '@datetime("yyyy-MM-dd hh:mm:ss")'
				},
				'orderPayment': {
					'id': '@increment(1)',
					'prepayId': '@increment(1)',
					'originalCode|6': /[0-9]/,
					'amount': 0,
					'ct': '@increment(2)',
					'statu': 0,
				},
				'orderItems|4-5': [{
					'id': '@increment(1)',
					'productId': '@increment(1)',
					'productName': '@cparagraph()',
					'count': 1,
					'total': '@increment(2)',
					'productCover': '@image("120x120")',
					'price': 1,
				}, ]
			}
		})
	},
	{
		key: "/order/info",
		method: "post",
		param: {
			address: "",
			items: ""
		},
		data: Mock.mock({
			'STATUS': "SUCCESS",
			'DATA': {
				id: 1
			}
		})
	},
	{
		key: "/order/info",
		method: "put",
		param: {
			id: '',
			statu: "",
		},
		data: function() {
			return Mock.mock({
				'STATUS': "SUCCESS",
				'DATA': "",
			});
		}
	},
	{
		key: "/order/before",
		method: "get",
		param: {
			products: "[1,2,3]",
			carts: "[1,2,3]",
		},
		data: function() {
			return Mock.mock({
				'STATUS': "SUCCESS",
				'DATA': [
					{
						"count|1-3": /[1-9]/,
						product: {
							id: "@increment(1)",
							'name': '八角亭 【5饼*提】2021年诚系列冰岛古树普洱生茶叶礼盒黎明茶厂',
							'category': '[{"id":"1","name":"普洱茶"},{"id":"2","name":"生茶"},{"id":"3","name":"冰岛古树"}]',
							'price|2-6': /[1-9]/,
							cover: "http://www.yanyucha.com/vancheerfile/images/2022/6/2022062010270074.jpg",
							'stock|1-2': /[1-9]/,
						},
					},
					{
						"count|1-3": /[1-9]/,
						product: {
							id: "@increment(1)",
							'name': '八角亭 【5饼*提】2021年诚系列冰岛古树普洱生茶叶礼盒黎明茶厂',
							'category': '[{"id":"1","name":"普洱茶"},{"id":"2","name":"生茶"},{"id":"3","name":"冰岛古树"}]',
							'price|2-6': /[1-9]/,
							cover: "http://www.yanyucha.com/vancheerfile/images/2022/6/2022062010270074.jpg",
							'stock|1-2': /[1-9]/,
						},
					},
				],
			});
		}
	},
];

export default order;
